Skip to content

bpo-45383: Inherit MetaClass from bases in FromSpec API#28748

Merged
encukou merged 19 commits intopython:mainfrom
seberg:fromspec-metatype-inheritance
Jun 9, 2022
Merged

bpo-45383: Inherit MetaClass from bases in FromSpec API#28748
encukou merged 19 commits intopython:mainfrom
seberg:fromspec-metatype-inheritance

Conversation

@seberg
Copy link
Contributor

@seberg seberg commented Oct 5, 2021

This checks the bases of of a type created using the FromSpec
API to inherit the bases metaclasses. The MetaClasses alloc
function will be called as is done in tp_new for classes
created in Python.


I have tested that both tests fail on the dev branch without the fix. This doesn't explicitly test that using tp_bases also works (yet). It also doesn't test the allocation size, the way it is written if the metaclass is set correctly (through allocation), then the allocation should also be correct.
(I have not done that, because that would require creating a MetaClass that extends the PyHeaptType_Object. Certainly possible, but it seemed a bit much – although that is my secret agenda ;)).

https://bugs.python.org/issue45383


  • Test that __subclasses__ is set correctly
  • Call type_new_init_subclass()?
  • Explicitly test that using tp_bases also works
  • Check the allocation size?

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants